import os

"""""""""""""""""""""""""""""""""
        server setting
"""""""""""""""""""""""""""""""""


class server:
    # host = '192.168.123.104'  # if write this, it can't be accessed by localhost
    host = '0.0.0.0'  # if write 0.0.0.0, it can't be accessed by localhost
    port = 12100
    debug = True
    base_url = '/c12100'  # 必须以/开头，修改此处需要到vite.config.js那边修改base并重新build一份
    base_axios_url = '/c12100/axios'  # 必须以/开头
    https = False


class security:
    server_admin_password: str = "password"
    jwt_secret_key: str = 'hello_next_hello'
    jwt_mix_key: str = 'hell'
    jwt_algorithm: str = 'HS256'
    jwt_expired_time: int = 36000  # （秒） 可以设置为任意>0的数
    cookie_expired_time: int = 0  # （秒） 当设置为0时，浏览器(不是标签页）一关掉就立即自动清理，>0时为登陆时间+这个值=过期时间
    allow_directory_browse: list[str] = ['/']  # 字符串数组留空=禁止浏览，填任意目录表示可以浏览（如/、/mnt、/home/user1）
    deny_directory_browse: list[str] = []
    hide_critical_path = True   #隐藏如/proc、/sbin、/etc等目录


class path:
    dir_project_root = os.path.abspath(os.path.dirname(__file__))

    dir_html_static_folder = os.path.join(dir_project_root, 'WebApp')
    dir_web_backend_folder = os.path.join(dir_project_root, 'WebBackend')

    dir_rundata = os.path.join(dir_project_root, 'rundata')
    dir_backup = os.path.join(dir_rundata, 'backup')
    dir_conf_delete_backup = os.path.join(dir_backup, 'delete')
    dir_conf_directEdit_backup = os.path.join(dir_backup, 'direct_edit')

    file_vsftpd_conf = '/etc/vsftpd.conf'  # 可以留空（系统自动检测），也可以手动指定
    file_vsftpd_conf_local_backup = '/etc/vsftpd.conf.sa-backup'  # 原地备份
    file_vsftpd_conf_prog_backup = os.path.join(dir_backup, 'vsftpd.conf.sa-backup')  # 异地备份
    file_samba_conf = '/etc/samba/smb.conf'
    file_samba_conf_local_backup = '/etc/samba/smb.conf.sa-backup'
    file_samba_conf_prog_backup = os.path.join(dir_backup, 'smb.conf.sa-backup')  # 异地备份

    dir_vsftpd_conf = '/etc/vsftpd'
    file_virtual_user_list = os.path.join(dir_vsftpd_conf, 'virtual_users.txt')
    file_virtual_user_db = os.path.join(dir_vsftpd_conf, 'virtual_users.db')
    dir_virtual_user_conf = os.path.join(dir_vsftpd_conf, 'virtual_users')

    dir_runlog = os.path.join(dir_rundata, 'mylog')
    file_mylog = os.path.join(dir_runlog, 'mylog.log')
    file_datalog = os.path.join(dir_runlog, 'datalog.log')

    dir_example_file = os.path.join(dir_web_backend_folder, 'store', 'examples')
    file_ssl_key = os.path.join(dir_web_backend_folder, 'key.pem')
    file_ssl_cert = os.path.join(dir_web_backend_folder, 'cert.pem')


"""""""""""""""""""""""""""""""""
    Auto Script  
"""""""""""""""""""""""""""""""""
